import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './assets/css/iconfont.css'
import axios from "axios"

Vue.prototype.$request = axios
Vue.config.productionTip = false
Vue.use(ElementUI);

// 全局路由前置守卫
router.beforeEach((to,from,next) =>{
  const token = localStorage.getItem('userInfo')
  if (to.path != '/login' && !token) {
    next('/login')
  }else{
    next()
  }
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
